package edu.whut.jdk8;

import java.time.LocalDate;
import java.time.format.DateTimeFormatter;
import java.time.temporal.ChronoUnit;
import java.util.Scanner;

/*
录入用户生日，计算实际年龄
 */
public class Test {
    public static void main(String[] args) {
        System.out.println("输入生日:2006.05.19");
        Scanner sc = new Scanner(System.in);
        String bir = sc.next();


        //一个M，一个d就行
        LocalDate birth = LocalDate.parse(bir, DateTimeFormatter.ofPattern("yyyy.M.d"));

        LocalDate now = LocalDate.now();

        System.out.println(ChronoUnit.YEARS.between(birth,now));



    }
}
